<?php
class Socialprofiles_Model_Pagedecision implements Socialprofiles_Model_Mainable{
    
    private $action_handler;
    
    public function main(array $variables = null) {
        
        switch($variables['get']['page']){
            case 'wstaw-ustawienia':
                return $this->insert_social_data($variables);
                break;
            case 'aktualizuj-ustawienia':
                return $this->update_social_data($variables);
                break;
            default :
                return $this->default_action($variables);
                break;
        }
    }
    
    private function update_social_data(array $variables = null){
        $this->action_handler = new Socialprofiles_Model_Updatesocialprofiles;
        return $this->action_handler->main($variables);
    }
    
    private function insert_social_data(array $variables = null){
        $this->action_handler = new Socialprofiles_Model_Insertsocialprofiles;
        return $this->action_handler->main($variables);
    }
    
    private function default_action(array $variables = null){
        unset($variables['get']);
        $this->action_handler = new Socialprofiles_Model_Socialprofiles;
        return $this->action_handler->main($variables);
    }
}
